import Vue from 'vue'
import Router from 'vue-router'

// 主页index 和 登陆 login  components
import Login from '../components/login/Index'
import Index from '../components/home/Index'

// 重复路由点击 warning clear
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(Router)


export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index,
      children: [
        {
          path: '/',
          name: 'Index',
          component: Index
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: Login,
    },
    // 默认的找不到的 404
    // { path: '/404', component: () => import('@/pages/404') },
    // { path: '*', redirect: '/404' }
    
  ]
})
